<template>
	<el-breadcrumb  style="padding: 30px;">
	   <el-breadcrumb-item>首页</el-breadcrumb-item>
	   <el-breadcrumb-item>大屏状态管理</el-breadcrumb-item>
	   <el-breadcrumb-item>门店最新活动</el-breadcrumb-item>
	</el-breadcrumb>
	<div>

		<el-table class="mb20" :data="tableData" border style="width: 100%">
			<el-table-column prop="title" label="活动名称" width="300" />
			<el-table-column prop="allshop" label="店名"  width="500">
				
				<template #default="scope">
					<el-tag style="margin-left:10px;" v-for="t in scope.row.allshop">{{t}}</el-tag>
				</template>
			</el-table-column>
			
			<el-table-column prop="images" label="活动图片" >
				<template #default="scope">
					<el-image style="height: 200px;" :src="ifImgHeader(scope.row.images)"
						:preview-src-list="[ifImgHeader(scope.row.images)]">
					</el-image>
				</template>
			</el-table-column>
			
		</el-table>

	</div>
</template>

<script>
	import {
		ElMessageBox,
		ElMessage
	} from "element-plus";
	export default {
		components: {},
		watch: {
			times() {
				this.form.starttime = this.times[0];
				this.form.endtime = this.times[1];
			},
		},
		data() {
			return {
				status: {
					0: "审核中",
					1: "正常",
					2: "隐藏",
					3: "不通过",
				},
				viewarr: [],
				modalStatewins: false,
				hdqtxmname: "", //     名称
				hdjifen: "", //   加积分
				numbers: "", //  手机
				modalStatewin: false,
				qrcode: null,
				modalStatecode: false,
				vtimes: ["", ""],
				formLabelWidth: "120px",
				times: "",
				form: {
					is_show: "1",
					images: "",
					content: "",
					jifen: "",
					starttime: "",
					endtime: "",
					title: "",
					is_hot: "0",
					author: "0",
				},
				tableData: [],
				rules: {
					title: [{
						required: true,
						message: "请填写标题",
						trigger: "blur",
					}, ],
					jifen: [{
						required: true,
						message: "请填写积分",
						trigger: "blur",
					}, ],
					content: [{
						required: true,
						message: "请填写内容",
						trigger: "blur",
					}, ],
					starttime: [{
						required: true,
						message: "请选择时间",
						trigger: "change",
					}, ],
				},
				pid: [],
				bqlist: [],
			};
		},
		async mounted() {
			// await this.$http.post("index.php/index/Admins/bqlist").then((data) => {
			//   this.bqlist = data;
			// });
			await this.getData();
		},
		methods: {
			getDatas() {
				this.page = 1;
				this.getData()
			},
			getData() {
				this.$http
					.post("/index.php/index/goodses/shopnamehdlists", {
						page: this.page,
						pagesize: 10,
						city: this.selectData,
						names: this.keywords
					})
					.then((datas) => {

						this.tableData = datas.data;

					});
			},
			submit(ref) {
				console.log(this.$refs);
				this.doRules(this.$refs[ref]).then(() => {
					if (this.id) this.form.id = this.id;

					this.$http
						.post(
							this.id ?
							"/index.php/index/Userinfo/hdedittj" :
							"/index.php/index/Userinfo/hdadd",
							this.form
						)
						.then((data) => {
							console.log(data);
							this.modalState = false;
							ElMessage({
								message: this.id ? "编辑成功" : "新增成功",
								type: "success",
							});
							this.getData();
						});
				});
			},
			remove(data) {
				this.$http
					.post("/index.php/index/Userinfo/hddel", {
						id: data.row.id
					})
					.then((data) => {
						ElMessage({
							message: "删除成功",
							type: "success",
						});
						this.getData();
					});
			},
			handleAvatarSuccess(file) {
				this.form.image = file.data;
			},
		},
	};
</script>
